/**
 * 用户表模型
 */

import { DataTypes } from 'sequelize'

export default (server) => {
    const { sequelize } = server;
    const User = sequelize.define('user', {
        pk: {
            type: DataTypes.UUID,
            defaultValue: DataTypes.UUIDV4,
            primaryKey: true,
            comment: '主键'
        },
        account: {
            type: DataTypes.STRING(200),
            comment: '账号'
        },
        password: {
            type: DataTypes.STRING(2000),
            comment: '密码'
        },
        administrator: {
            type: DataTypes.BOOLEAN,
            defaultValue: false,
            comment: '管理员用户'    // {true:是,flase:否}
        },
        role: {
            type: DataTypes.STRING(200),
            comment: '角色/身份'
        }
    })
    return User;
}